Improving service efficiency and throughput of cardiac surgery patients using Monte Carlo simulation: a queueing setting

Bed occupancy rate (BOR) is important for healthcare policymakers. Studies showed the necessity of using simulation approach when encountering complex real-world problems to plan the optimal use of resources and improve the quality of services. So, the aim of the present study is to estimate average length of stay (LOS), BOR, bed blocking probability (BBP), and throughput of patients in a cardiac surgery department (CSD) using simulation models. We studied the behavior of a CSD as a complex queueing system at the Farshchian Hospital. In the queueing model, customers were patients and servers were beds in intensive care unit (ICU) and post-operative ward (POW). A computer program based on the Monte Carlo simulation, using Python software, was developed to evaluate the behavior of the system under different number of beds in ICU and POW. The queueing simulation study showed that, for a fixed number of beds in ICU, BOR in POW decreases as the number of beds in POW increases and LOS in ICU increases as the number of beds in POW decreases. Also, based on the available data, the throughput of patients in the CSD during 800 days was 1999 patients. Whereas, the simulation results showed that, 2839 patients can be operated in the same period. The results of the simulation study clearly demonstrated the behavior of the CSD; so, it must be mentioned, hospital administrators should design an efficient plan to increase BOR and throughput of patients in the future.


Material and methods
Data and patients. This study was approved by the ethics committee of Hamadan University of Medical Sciences (Approved ethical code: IR.UMSHA.REC.1398.396), and all methods were carried out in accordance with relevant guidelines and regulations. Prior written informed consent was obtained from all the participants.
In this study, we collected data from computerized (electronic) medical records of 1999 patients who underwent cardiac surgery, including three categories: 1. CABG, 2. Aortic Valve Replacement, Mitral Valve Replacement and Tricuspid Valve Replacement and 3. Heart Septal Defects: Ventricular Septal Defect and Atrial Septal Defect, at the Farshchian Heart center in Hamadan, Iran, during a 26-month period, 800 days, from 22 December 2017 to 29 February 2020.
The patients who did not respond to conventional therapeutic procedures, in order to surgical consultation were referred to a cardiac surgeon by a cardiologist. After examination and observation of medical evidence by surgeons, eventually they may become candidates for cardiac surgery. The patients were generally classified into emergency (non-elective) and elective groups according to their clinical conditions. Emergency patients were operated earlier than elective patients without being discharged from the hospital. The elective patients entered into cardiac surgical waiting list to call for surgery according to turn schedule. In this center, there were four on-call surgeons to do cardiac surgery on their duties. Also, at present, the CSD act with 10 beds in ICU and 16 beds in POW. The general flow of patients and the possible events that occur in the CSD are as follows: First, patients arrive to a preoperative ward from the waiting list, then go to the operating room for operation, and afterward are transferred to the ICU for recovery, then move to POW, and finally discharged. This situation is portrayed in Fig. 1.
Each patient normally stays one or two days in preoperative ward; if there is an empty bed in ICU, she/he undergoes surgery and stays in ICU for at least one day. Depending on the patient's clinical conditions, she/he has a different LOS in ICU and POW. Due to the fact that the number of deaths that occurred during and after www.nature.com/scientificreports/ surgery was very small and insignificant, we did not consider it in the simulation program. Since the unit of time is a day, and the events occur sequentially at discrete points of time, also, the simulation time is advanced simultaneously along with occurrence time of events, therefore, the system under study can be seen as a discreteevent system. Hence, we considered this type of simulation approach as discrete event simulation.
In some epidemic conditions such as coronavirus disease 2019 (COVID-19), in order to isolate patients, the admission of patients in CSD was affected and the POW was usually closed. Therefore, patients were discharged from the ICU after surgery. In system simulation, these conditions can be considered by keeping and prolonging each patient's stay in the ICU until discharge and zeroing the POW LOS. This situation can be implemented by adding a module (subroutine) to the simulation program.
In the simulation program, the exact path of Patients' movements within the system and the LOS in each ward is kept tracked and controlled on a daily period. In the following, we list the details of the basic assumptions that were considered when developing the simulation program: 1. The LOS in the ICU and the POW was defined as the number of nights that a bed is occupied by each patient. 2. There are always some patients on the waiting list. In other words, there is an infinite supply of patients waiting to have cardiac surgery. 3. Elective patients were operated in order of admission times. (Known as the first-come, first-served rule in queueing theory). 4. Patient ' s surgery and admission is performed on all weekdays, except Fridays and public holidays. 5. Patients can be discharged on any day of the week. 6. During a year, about 20% of the days were holidays (about 14% on Fridays and 6% on other public holidays). In fact, rather than actual dates of holidays, each day was simulated to be a holiday with a probability of 0.2. 7. In the queueing system, beds were the servers and patients were considered as the customers. 8. The order in which events are simulated in the system is for: a. A discharged patient, b. A patient who is leaving ICU to POW, c. A patient who is arriving from preoperative ward to ICU, d. Finally, admission of a new patient from waiting list.
In the Monte Carlo-based simulation method 40,41 , the first important step is finding the distribution functions of LOS (service time) in ICU and POW. In this study, at first, some common parametric distributions including Lognormal, Gamma, Weibull and Loglogistic were fitted to the LOS data in ICU and POW by using "actuar" 42 and "fitdistrplus" 43 packages in R software version 4.1.2, then, based on the highest log likelihood statistics, the best distributions for LOS in ICU and POW were chosen.
The bed blocking probability (BBP) was considered as the probability of a ready patient is not able to move from ICU to POW due lack of empty beds in POW. This probability was computed as the ratio of the number of patients who are not able to move from ICU to POW due lack of empty beds in POW to the total number of patients who are ready to move from ICU to POW.
The parameters for the fitted LOS distributions in the ICU and POW, the number of simulation days, and the number of beds in ICU and POW were given as input into the simulation program. After initialization, the system was simulated with 500 replications. The average and standard deviation (SD) of desired performance measures were calculated. The desired performance measures of our simulation study were, estimation of average BOR, LOS in ICU, throughput of patients in the system, and BBP. The simulation program code was written in Python programming software, version 3.9.5, along with installing and importing all necessary libraries 44 . GraphPad Prism software (version 6.0, GraphPad, San Diego, CA, USA) was also used.

Results
Descriptive results. The mean (SD) of LOS in ICU and POW were 2.62 (0.94) and 2.78 (1.01) days, respectively. Figures 2 and 3 show visually empirical LOS distribution based on the real data and some fitted parametric distributions to LOS (days) in ICU and POW, respectively. As can be seen, most patients spend two (48.9% and 36.8%) or three (36.6% and 37.4%) days in ICU and POW, respectively. Based on the highest log-likelihood values, the best fitted distribution for LOS in ICU was the Log logistic distribution (shape parameter β = 5.55 and scale parameter α = 2.46) and for POW was the Gamma distribution (shape parameter β = 7.53 and scale parameter α = 0.37). As Fig. 4 shows when there are 10 beds in ICU and 5 beds in POW the BBP is 0.73 which approaches zero when the number of beds in POW exceeds 11. Finally, as Fig. 5 demonstrate, as the number of POW in beds increases, the LOS in ICU stabilized at 2.6 days which is compatible with the empirical average of LOS in ICU that was 2.66 days. Table 3 shows the simulation results when there are several months of COVID-19 restrictions throughout the year. For example, if the restriction is applied for a quarter of the days of the year, three months, with 10 beds in the ICU and 16 beds in the POW, the patient throughput drops from 2839 to 2251. In general, as the percentage of COVID-19 restrictions increases, fewer patients undergo surgery during the 800 study days.

Discussion
The application of simulation models is broadly common in healthcare systems to improve hospital resources management. Hospitals as one of the most important units of the healthcare systems, accounting for 50 to 80 percent of total health care costs. Because of that, their optimal and efficient management has become one of the challenges of governments and health sector managers in recent decades 45 . Many studies have used analytical and simulation methods to solve some of the problems in this field 20,30,32,36,38,46,47 . Whatever the complexity of the systems increases, analytical models are not responsive because they fail to capture the details. For this reason, one of the basic strategies for overcoming these limitations in the study of dynamic and complex systems is use of very flexible simulation methods 44 . In this study, we have developed a discrete-event simulation model of a CSD of a hospital in Iran. Therefore, we used a Monte Carlo simulation approach to mimic the behavior of patients in a CSD as a dynamic system; So, some of the performance measures including, the mean BOR, LOS,
In this study, beds play the role of servers, so the main purpose was to determine the optimal number of beds, especially in ICU, because the cost of providing and adding a bed in ICU, as a bottleneck resource, is much higher than in POW. Since financial resources are limited, it is important to be able to justify and satisfy hospital managers before spending money and purchasing new equipment. They are also convinced that the new changes, the optimal allocation of resources and beds will lead to long-term financial profits; and also, an increase in hospital revenue in the future.
One of the advantages of this study is use of very powerful and popular programming software, Python 44 . In many simulation studies, the application of Python software is expanding due to its high flexibility in modeling complex systems and its ability to consider real-world scenarios. Although various simulation software is now designed and readily available in academic and industrial settings 50,51 , however, choosing the appropriate one is a difficult task because many of them are not suitable or even applicable in some complex situations. Also, it is practically impossible for researchers to develop them in new situations. Another main strength of our study is considering annual holidays in the simulation program, so that about 20% of the days of the year, including 14% Fridays and 6% of public holidays, no surgery was performed. In general, our simulation program is precisely set up based on the realities that occur in the CSD.
To check the accuracy of the results of LOS modeling (Log logistic and gamma distributions), the empirical distributions of LOS were also used for simulation. Since the results of the two approaches were close to each other, it can be concluded that the models were chosen correctly and the simulation results are valid.
There are some limitations in this study. As mentioned earlier, a number of assumptions were taken into account during modeling and programming. We implicitly assumed that there was no limit on number of surgeons or operating rooms. So, as soon as an empty bed is in ICU, a patient would undergo surgery. However, not only the number of surgeons is limited, four surgeons in this study, the number of surgeries performed by each surgeon is also limited maximum of two surgeries per day.
In future studies, this limitation can be addressed by considering the surgeons and beds in the role of servers as well. Furthermore, taking into account average total cost of staying in the system may also help to study this system more precisely.
In the present study, deaths were not considered in simulation program; this is not a disadvantage of the study, because the number of deaths occurring during or after the operation was very low; but for future research, if the percentage of postoperative deaths is high, it is a good idea to consider different scenarios of deaths in simulation program to better understand the behavior of the system.
In this research, patients who were candidates for cardiac surgery, were grouped into two classes; nonemergency and emergency, and priority must be given to the latter group, but we have assumed that all patients have the same priority and undergo surgery in the order of admission. According to a report of Iranian hospitals affiliated to the Ministry of Health and Medical Education of Iran, the BOR in Iranian hospitals in 2008 was estimated at 57.8 percent, which shows a significant difference with the global standard index (85-90 percent) 39 . This in line with our study that confirms with the current facilities, equipment, and medical personnel of investigated system, i.e. 10 and 16 beds (sometimes plus two extra beds) in ICU and POW, respectively, 1999 cardiac surgeries were performed during 800 days. But the results of the simulation program showed that with the same conditions, 2839 patients are expected to undergo surgery. In other words, the hospital system, with its current facilities, equipment and manpower, operates approximately 43% less than its actual efficiency. As already mentioned, the empirical average LOS in ICU was 2.66 days, and the simulation results also confirm that, as the number of POW beds increased, the LOS in ICU stabilized at 2.6 days.
The simulation program we have extended in this study can also be applied in other areas. If during the year, the admission of patients is affected by the restrictions of the COVID-19 or other epidemics, these conditions can be considered in the simulation program. In our study, as previously mentioned, this situation is allowed by prolonging each patient's ICU stay until discharge and setting POW LOS to zero in the simulation program. For instance, based on the simulation results, with 10 beds in the ICU and 16 beds in the POW, if we assume 4 months of restrictions per year, the throughput of patients is reduced from 2839 to 2114 during 800 days, a 25.5% reduction. On the other hand, based on the raw data, the average number of monthly surgeries before and after the covid epidemic was 66.78 and 51. 26 www.nature.com/scientificreports/ by about 23%. Therefore, the hospital's performance also confirmed that after the COVID-19 epidemic, patient admissions have decreased by almost the same proportion.
Since this simulation program depends on the LOS distribution of patients in the POW and ICU, it can be used for other diseases where patients are admitted to one or two consecutive wards. However, this program can also be extended to three or more consecutive sections.
Improving the efficiency, throughput, optimization of hospital system facilities, balancing between the supply of services by the hospital and also the demand for services by patients is a win-win approach. If waiting times would be shorter, patients will be able to access services faster. So, hospitals with proper planning for the future, have a strategy for optimal use of resources and its allocation; therefore, it would prevent the pressure of congestion and increasing demand.
In conclusion, the results of this simulation study were able to show behavior and performance measures of the system by considering different numbers of beds in ICU and ward clearly. Therefore, according to the simulation results, hospital managers can not only make optimal use of available resources and increase system efficiency, but would also be able to provide accurate planning for the future.

Data availability
The data that support the findings of this study are available from Hossein Mahjub (Email: mahjub@umsha. ac.ir) but restrictions apply to the availability of these data, which were used under license for the current study, and so are not publicly available. Data are however available from the authors upon reasonable request and with permission of the corresponding author.

Code availability
The codes that support the findings of this study are available from Hossein Mahjub (Email: mahjub@umsha. ac.ir) but restrictions apply to the availability of these codes, which were used under license for the current study, and so are not publicly available. Codes are, however available from the authors upon reasonable request and with permission of the corresponding author. License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.